package com.micro.modual.controller;

import com.micro.common.MicroResponseCode;
import com.micro.core.resp.RespJsonData;
import com.micro.plugins.oshi.ServerInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

/**
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020/6/25
 */
@RestController
@RequestMapping(value = "/serve")
public class ServerController {

    @GetMapping(value = "/findServeInfo")
    public RespJsonData<ServerInfo> findServeInfo() throws UnknownHostException {
        ServerInfo serverInfo = new ServerInfo();
        serverInfo.info();
        return new RespJsonData<ServerInfo>(serverInfo, MicroResponseCode.SUCCESS.getResponseCode(),MicroResponseCode.SUCCESS.getResponseMessage());
    }
}
